<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div class="panel panel-info panel-content">
		<div class="panel-heading">
			<form id="soform" method="post">
				<table>
					<tr>
						<td class="w80"><label for="so_state" class="center-block">审核状态:</label>
						</td>
						<td class="w120"><select class="form-control" id="so_state"
							name="so_state">
								<option value="">全部</option>
								<option value="0">待审核</option>
								<option value="1">通过</option>
								<option value="2">未通过</option>
						</select></td>
						<td>
							<div class="input-group">
								<input type="text" class="form-control" name="so_name"
									value='${so_name!}' placeholder="品牌名称"> <span
									class="input-group-btn">
									<button class="btn btn-default" type="button" onclick="sosuo()">搜索</button>
								</span>
							</div>
						</td>
						<td
							style="padding-left: 10px; font-size: 12px; font-family: inherit; color: inherit;">
							<button style="float: right" type="button"
								onclick="addBrand()" class="btn btn-info">
								<span class="glyphicon glyphicon-plus"></span> &nbsp;添加品牌
							</button>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<table
			class="table table-hover table-bordered table-striped table-condensed">
			<thead>
				<tr>
					<th width="30">#</th>
					<th>排序</th>
					<th>名称</th>
					<th>产品类目</th>
					<th>是否自营</th>
					<th>审核状态</th>
					<th>创建时间</th>
					<th width="200">操作</th>
				</tr>
			</thead>
			[#list pagination.list as pro_brand ]
			<tr>
				<td>${pagination.pageSize *
					(pagination.pageNo-1)+pro_brand_index+1}</td>
				<td align="center" width="80">${pro_brand.seq!}</td>
				<td align="center">${pro_brand.name!}</td>
				<td align="center" width="300">[#if  pro_brand.proCategoryBrands??][#list pro_brand.proCategoryBrands as categoryBrand][#if categoryBrand.categoryf??]${categoryBrand.categoryf.name!}[/#if]-${categoryBrand.categorys.name!}-${categoryBrand.categoryt.name!}；[/#list][/#if]</td>
				<td align="center">[#if pro_brand.ifSelf==0]否[#elseif
					pro_brand.ifSelf==1]是[/#if]</td>
				<td align="center">[#if pro_brand.state==0]待审核[#elseif
					pro_brand.state==1]已审核[#elseif pro_brand.state==2]未通过[/#if]</td>
				<td align="center">[#if pro_brand.createtime??]${pro_brand.createtime?string("yyyy-MM-dd HH:mm")}[/#if]</td>
				<td align="center">
					<button type="button" class="btn btn-xs btn-info"
						onclick="editBrand(${pro_brand.id!})">编辑</button>
					<button type="button" class="btn btn-xs btn-danger"
						onclick="removeBrand(${pro_brand.id!})">删除</button>
				</td>
			</tr>
			[/#list]
		</table>

		<div class="panel-footer">[@fenye p = pagination form =
			'infoForm' /]</div>
	</div>


	<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
	<script src="/res/third/artDialog/jquery.artDialog.js"
	type="text/javascript"></script>
	<script type="text/javascript">
		function sosuo() {
			var lpath = location.pathname;
			var pageNo = $("#pageNo").val();
			$("#soform").attr("action", lpath + "?pageNo=" + pageNo);
			$("#soform").submit();
		}

		function removeBrand(id) {
			if (confirm("确定要删除吗？")) {
				$.ajax({
					url : '/brandmanager/removeBrand.do',
					type : 'post',
					dataType : 'json',
					data : {
						id : id
					},
					success : function(data) {
						if (data && data.success) {
							art.dialog.tips("操作成功");
							location.reload();
						} else {
							art.dialog.tips(data.msg);
						}
					}
				});
			}
		}

		function addBrand(){
			location.href='/brandmanager/getBrandById.do';
		}
		
		function editBrand(id) {
			location.href='/brandmanager/getBrandById.do?id='+id;
		}

	</script>
</body>
</html>